<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>增加客户</title>
<script src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
         //初始化
         $(document).ready(function(){
        	 //省
        	 getPro("#pro",0);
        	 //市
        	 $("#pro").change(function(){
            	 var id=$("#pro").val();
            	 getPro("#city",id);
                 $("input[name='city']").val(id);
             });
        	 //区
        	 $("#city").change(function(){
            	 var id=$("#city").val();
            	 getPro("#area",id);
            	 $("input[name='city']").val(id);
             });
        	 $("#area").change(function(){
        		 var id=$("#area").val();
            	 $("input[name='city']").val(id);
             });
         });

     	
         //省市获取
		 function getPro(obj,proId){
			 $.getJSON('proCustomer.action',{'proId':proId},function(data){
				 $(obj).html('<option id="-1">--请选择--</option>');
				 $("#area").html('<option id="-1">--请选择--</option>');
				 for ( var i = 0; i < data.length; i++) {
			         $(obj).append('<option value="'+data[i].id+'">'+data[i].name+'</option>');
				 }
		     });
	     }
		 function ret(){
			   location.href="index.jsp";
		   }
</script>

<s:if test="#request.industrys==null">
  <jsp:forward page="add_blank.jsp"></jsp:forward>
</s:if>
<link href="../css/table.css" rel="stylesheet" type="text/css">
</head>
<body>
<s:form action="addCustomer" method="post" id="form1"  theme="simple" >
  <table width="500" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="table_rightf">名称:</td>
    <td class="tableleftf"><input type="text" name="customer.custName"></td>
  </tr>
  <tr>
    <td class="table_rightf">电话:</td>
    <td class="tableleftf"><input type="text" name="customer.custTellphone"></td>
  </tr>
  <tr>
    <td class="table_rightf">主页:</td>
    <td class="tableleftf"><input type="text" name="customer.custWeburl"></td>
  </tr>
  <tr>
    <td class="table_rightf">省市:</td>
    <td class="tableleftf"><input type="hidden" name="city" value="-1">
        <select id="pro">
           <option id="-1">--请选择--</option>
        </select>
        <select id="city">
           <option id="-1">--请选择--</option>
        </select>
        <select id="area">
           <option id="-1">--请选择--</option>
        </select>
    </td>
  </tr>
	   
  
  <tr>
    <td class="table_rightf">客户行业：</td>
    <td class="tableleftf"><s:select name="industry" list="industrys" listKey="typeId" listValue="typeValue"  theme="simple" ></s:select></td>
  </tr>
  
  <tr>
    <td class="table_rightf">客户等级:</td>
    <td class="tableleftf"> <s:select name="live" list="lives" listKey="typeId" listValue="typeValue"  theme="simple" ></s:select></td>
  </tr>
  
  <tr>
    <td class="table_rightf">客户性质:</td>
    <td class="tableleftf"><s:select name="nature" list="natures" listKey="typeId" listValue="typeValue"  theme="simple" ></s:select></td>
  </tr>
  
  <tr>
    <td class="table_rightf">客户类型:</td>
    <td class="tableleftf"><s:select name="ctype" list="ctypes" listKey="typeId" listValue="typeValue"  theme="simple" ></s:select></td>
  </tr>
  
  <tr>
    <td class="table_rightf">客户来源:</td>
    <td class="tableleftf"><s:select name="source" list="sources" listKey="typeId" listValue="typeValue"  theme="simple" ></s:select></td>
  </tr>
  
  
  <tr>
    <td class="table_rightf">法人代表:</td>
    <td class="tableleftf"><input type="text" name="customerInfo.cinfoLegal"></td>
  </tr>
  <tr>
    <td class="table_rightf">短信:</td>
    <td class="tableleftf"><input type="text" name="customerInfo.cinfoMessagephone"></td>
  </tr>
  <tr>
    <td class="table_rightf">传真:</td>
    <td class="tableleftf"><input type="text" name="customerInfo.cinfoFax"></td>
  </tr>
  <tr>
    <td class="table_rightf">邮编:</td>
    <td class="tableleftf"><input type="text" name="customerInfo.cinfoZipcode"></td>
  </tr>
  <tr>
    <td class="table_rightf">地址:</td>
    <td class="tableleftf"><input type="text" name="customerInfo.cinfoAddress"></td>
  </tr>
  <tr>
    <td class="table_rightf">邮箱:</td>
    <td class="tableleftf"><input type="text" name="customerInfo.cinfoEmail"></td>
  </tr>
        
  <tr>
    <td class="table_rightf">备注:</td>
    <td class="tableleftf">
      <textarea name="customerInfo.cinfoIntroduction" id="textarea" cols="45" rows="5"></textarea>
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" value="  保  存  ">
    &nbsp;&nbsp;
      <input type="button" value="  返回首页  " onClick="ret()"></td>
  </tr>
</table>
</s:form>
</body>
</html>